#!/bin/sh
echo "---------------------清洗质押物信息表的数据--------------------"
hive -v -e "set hive.exec.mode.local.auto=true; \
insert overwrite table xm02dw.ple_info
select
ple_id,
ple_name,
cust_id,
regexp_replace(cust_name,'[^一-龥]+','') cust_name,
ple_type,
describefly,
quantity_area,
m_unit,
ple_value,
currency,
ple_term,
ple_rate,
s_time,
custody_dept,
custodian_id,
custodian,
ple_cid,
contract_id,
own_cert_id,
ple_status,
regexp_replace(eva_agency,'[^一-龥]+','') eva_agency,
eva_date,
val_period,
loc,
risk_ass,
remarks,
ins_id,
manager_id,
create_time,
update_time,
current_timestamp etl_time
from xm02ods.ple_info;"
echo $?
echo "-----------质押物表已清洗完成--------"
echo "----------------验证数据-------------------------"
c1=`hive -e "set hive.exec.mode.local.auto=true;select count(*) from xm02ods.ple_info;"`
echo "-----来源表数据量为:${c1}条"
c2=`hive -e "set hive.exec.mode.local.auto=true;select count(*) from xm02dw.ple_info;"`
echo "-----落地表数据量为:${c2}条"
if [ "$c1" == "$c2" ];then
echo "清洗成功！"
else
echo "清洗失败，请检查脚本"
fi